#!/bin/bash
BAENV=/var/code/sap/scripts/loadenv.sh
if [ -f $BAENV ]; then . $BAENV; else echo "No env library ($BAENV)"; fi
while [ true ]
do
	for i in sappr201 sappr202
	do
		if ! checkhost $i | grep -q not
		then
			echo `date` $i ok
		else
			echo `date` $i not pingable
			echo Trying again in 30 sec...
			sleep 30
			if ! checkhost $i | grep -q not
			then
				echo $i two times NOT pingable | mail -s "ping failure" ba2308102@e.pagenet.ca
			fi
			sleep 300
		fi
		sleep 5
	done
done
